#pragma once
#include"const.h"

struct SectionInfo
{
	SectionInfo() {};
	~SectionInfo() { _section_dates.clear(); };

	SectionInfo(const SectionInfo& src) {
		_section_dates = src._section_dates;
	};
	SectionInfo& operator=(const SectionInfo& src) {
		if (this == &src)
		{
			return *this;
		}
		this->_section_dates = src._section_dates;
		return *this;
	};


	std::string operator[](const std::string& key) {
	if(_section_dates.find(key)==_section_dates.end())
	{
		return "";
	}
	return _section_dates[key];


	};


	std::map<std::string, std::string> _section_dates;
};

class ConFigMgr
{
private:
	std::map<std::string, SectionInfo> _config_map;
	ConFigMgr();
public:
	~ConFigMgr() { _config_map.clear(); };
	
	static ConFigMgr& Inst()
	{
		static ConFigMgr cfg_mgr;
		return cfg_mgr;
	}

	ConFigMgr(const ConFigMgr& src) {
		_config_map = src._config_map;
	};

	ConFigMgr& operator=(const ConFigMgr& src) {
		if (this == &src)
		{
			return *this;
		}
		this->_config_map = src._config_map;

	};

	SectionInfo operator[](const std::string& key) {
		if (_config_map.find(key) == _config_map.end())
		{
			return SectionInfo();
		}
		return _config_map[key];
	};

};

